﻿using winS.UnityEditor.Undo;

namespace winS.UnityEditor.ProcessEditor
{
    public class CreateNodeCommand : IUndoCommand
    {
        public string info => "创建节点";

        private readonly StepNode stepNode;
        private readonly StepGraphView stepGraphView;

        public CreateNodeCommand(StepNode stepNode, StepGraphView stepGraphView)
        {
            this.stepNode = stepNode;
            this.stepGraphView = stepGraphView;
        }

        public void Redo()
        {
            stepGraphView.AddNode(stepNode);
        }
        public void Undo()
        {
            stepGraphView.RemoveNode(stepNode);
        }
    }
}